package com.nuoniu.sibanyun.controller.erp;


import com.nuoniu.sibanyun.common.BaseController;
import com.nuoniu.sibanyun.common.result.HttpResult;
import com.nuoniu.sibanyun.entity.dto.ErpVoucherTypeDto;
import com.nuoniu.sibanyun.entity.vo.ErpVoucherTypeVo;
import com.nuoniu.sibanyun.service.erp.IErpVoucherTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 单据编码规则 前端控制器
 * </p>
 *
 * @author baiqiang
 * @since 2020-09-28
 */
@RestController
@RequestMapping("/erp/voucherType")
@Api(value = "单据编码规则", tags = "单据编码规则")
public class ErpVoucherTypeController extends BaseController {

    @Autowired
    private IErpVoucherTypeService erpVoucherTypeService;

    @GetMapping("/list")
    @ApiOperation(value = "查询 启用的 单据编码规则")
    public HttpResult<List<ErpVoucherTypeVo>> list() {
        return HttpResult.ok(erpVoucherTypeService.listCurrentErpVoucherTypeVo());
    }


    @PostMapping("/update")
    @ApiOperation(value = "编辑")
    public HttpResult update(@RequestBody ErpVoucherTypeDto erpVoucherTypeDto) {
        erpVoucherTypeService.updateOne(erpVoucherTypeDto);
        return HttpResult.ok();
    }
}
